Optimal. Leaf size=106 \[ \frac {(b B-a C) \tanh ^{-1}(\sin (c+d x))}{b^2 d}+\frac {2 \left (A b^2-a (b B-a C)\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^2 \sqrt {a+b} d}+\frac {C \tan (c+d x)}{b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.17, antiderivative size = 106, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {4167, 4083,
3855, 3916, 2738, 214} \begin {gather*} \frac {2 \left (A b^2-a (b B-a C)\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^2 d \sqrt {a-b} \sqrt {a+b}}+\frac {(b B-a C) \tanh ^{-1}(\sin (c+d x))}{b^2 d}+\frac {C \tan (c+d x)}{b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3855
Rule 3916
Rule 4083
Rule 4167
Rubi steps
\begin {align*} \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx &=\frac {C \tan (c+d x)}{b d}+\frac {\int \frac {\sec (c+d x) (A b+(b B-a C) \sec (c+d x))}{a+b \sec (c+d x)} \, dx}{b}\\ &=\frac {C \tan (c+d x)}{b d}+\frac {(b B-a C) \int \sec (c+d x) \, dx}{b^2}+\left (A-\frac {a (b B-a C)}{b^2}\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx\\ &=\frac {(b B-a C) \tanh ^{-1}(\sin (c+d x))}{b^2 d}+\frac {C \tan (c+d x)}{b d}+\frac {\left (A-\frac {a (b B-a C)}{b^2}\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{b}\\ &=\frac {(b B-a C) \tanh ^{-1}(\sin (c+d x))}{b^2 d}+\frac {C \tan (c+d x)}{b d}+\frac {\left (2 \left (A b^2-a (b B-a C)\right )\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^3 d}\\ &=\frac {(b B-a C) \tanh ^{-1}(\sin (c+d x))}{b^2 d}+\frac {2 \left (A b^2-a (b B-a C)\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^2 \sqrt {a+b} d}+\frac {C \tan (c+d x)}{b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 2.56, size = 365, normalized size = 3.44 \begin {gather*} \frac {2 \cos (c+d x) (b+a \cos (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \left (-\left ((b B-a C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+(b B-a C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )-\frac {2 i \left (A b^2+a (-b B+a C)\right ) \text {ArcTan}\left (\frac {(i \cos (c)+\sin (c)) \left (a \sin (c)+(-b+a \cos (c)) \tan \left (\frac {d x}{2}\right )\right )}{\sqrt {a^2-b^2} \sqrt {(\cos (c)-i \sin (c))^2}}\right ) (\cos (c)-i \sin (c))}{\sqrt {a^2-b^2} \sqrt {(\cos (c)-i \sin (c))^2}}+\frac {b C \sin \left (\frac {d x}{2}\right )}{\left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}+\frac {b C \sin \left (\frac {d x}{2}\right )}{\left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}\right )}{b^2 d (A+2 C+2 B \cos (c+d x)+A \cos (2 (c+d x))) (a+b \sec (c+d x))} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.24, size = 152, normalized size = 1.43
method | result | size |
derivativedivides | \(\frac {-\frac {C}{b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {\left (-b B +a C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b^{2}}-\frac {C}{b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}+\frac {\left (b B -a C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b^{2}}-\frac {2 \left (-A \,b^{2}+a b B -a^{2} C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{2} \sqrt {\left (a +b \right ) \left (a -b \right )}}}{d}\) | \(152\) |
default | \(\frac {-\frac {C}{b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {\left (-b B +a C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b^{2}}-\frac {C}{b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}+\frac {\left (b B -a C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b^{2}}-\frac {2 \left (-A \,b^{2}+a b B -a^{2} C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{2} \sqrt {\left (a +b \right ) \left (a -b \right )}}}{d}\) | \(152\) |
risch | \(\frac {2 i C}{d b \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) a B}{\sqrt {a^{2}-b^{2}}\, d b}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) a^{2} C}{\sqrt {a^{2}-b^{2}}\, d \,b^{2}}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) a B}{\sqrt {a^{2}-b^{2}}\, d b}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) a^{2} C}{\sqrt {a^{2}-b^{2}}\, d \,b^{2}}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{b d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{b^{2} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{b d}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{b^{2} d}\) | \(550\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 213 vs.
\(2 (97) = 194\).
time = 8.45, size = 482, normalized size = 4.55 \begin {gather*} \left [\frac {{\left (C a^{2} - B a b + A b^{2}\right )} \sqrt {a^{2} - b^{2}} \cos \left (d x + c\right ) \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) - {\left (C a^{3} - B a^{2} b - C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left (C a^{3} - B a^{2} b - C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (C a^{2} b - C b^{3}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{2} b^{2} - b^{4}\right )} d \cos \left (d x + c\right )}, \frac {2 \, {\left (C a^{2} - B a b + A b^{2}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) \cos \left (d x + c\right ) - {\left (C a^{3} - B a^{2} b - C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left (C a^{3} - B a^{2} b - C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (C a^{2} b - C b^{3}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{2} b^{2} - b^{4}\right )} d \cos \left (d x + c\right )}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (A + B \sec {\left (c + d x \right )} + C \sec ^{2}{\left (c + d x \right )}\right ) \sec {\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.52, size = 180, normalized size = 1.70 \begin {gather*} -\frac {\frac {{\left (C a - B b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{b^{2}} - \frac {{\left (C a - B b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{b^{2}} + \frac {2 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} b} + \frac {2 \, {\left (C a^{2} - B a b + A b^{2}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{\sqrt {-a^{2} + b^{2}} b^{2}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 11.16, size = 2500, normalized size = 23.58 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________